﻿using Microsoft.SharePoint;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kaskelot.SP.Core;

namespace Kaskelot.SP.Services.Setup
{
	public class KursWebSetup : IWebSetup
	{
		public void Setup(SPWeb web)
		{
			web.Features.Reactivate(Constants.Features.KursPages);

			var v = new List<Model.Client.Tab> 
            {
                new Model.Client.Tab { TabIndex = 1, Title = "Kurser"}
            };

			if (web.AllProperties.ContainsKey(Constants.Tabs.TabConfiguration))
				web.AllProperties.Remove(Constants.Tabs.TabConfiguration);

			web.AllProperties.Add(Constants.Tabs.TabConfiguration, Precio.SharePoint.Core.XmlSerializer<List<Model.Client.Tab>>.Serialize(v));
			web.Update();
		}
	}
}
